package com.lianbang.staff.adapter

import cn.ubest.mvvmcore.utils.ResourcesUtils
import cn.ubest.mvvmcore.utils.SpanUtils
import com.chad.library.adapter.base.BaseQuickAdapter
import com.chad.library.adapter.base.viewholder.BaseViewHolder
import com.lianbang.staff.R
import com.lianbang.staff.bean.OrderListBean

/**
 * Created by maoqi on 2020/12/28.
 */
class OrderAddListAdapter :
    BaseQuickAdapter<OrderListBean, BaseViewHolder>(R.layout.item_order_add_list) {
    override fun convert(helper: BaseViewHolder, item: OrderListBean) {
        val spanUtils = SpanUtils()
        for (cartInfo in item.cart_info) {
            spanUtils.append("${cartInfo.cate_name}${cartInfo.cart_num}盒，")
        }

        helper.setText(R.id.tv_title, item.nickname)
            .setText(R.id.tv_order_number, item.order_id)
            .setText(
                R.id.tv_content,
                spanUtils
                    .append("总金额")
                    .append(item.total_price)
                    .setBold()
                    .setForegroundColor(ResourcesUtils.getColor(R.color.C_F74850))
                    .append("元")
                    .create()
            )
    }

}